package com.example.common;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 分页结果类
 * @param <T> 数据类型
 */
@Data
@NoArgsConstructor
@Schema(description = "分页结果")
public class PageBean<T> {
    @Schema(description = "总记录数", example = "100")
    private Long total;          // 总记录数
    
    @Schema(description = "当前页数据")
    private List<T> rows;        // 当前页数据
    
    @Schema(description = "当前页码", example = "1")
    private Integer currentPage; // 当前页码
    
    @Schema(description = "每页大小", example = "10")
    private Integer size;        // 每页大小
    
    public PageBean(Long total, List<T> rows) {
        this.total = total;
        this.rows = rows;
    }
    
    public PageBean(Long total, List<T> rows, Integer currentPage, Integer size) {
        this.total = total;
        this.rows = rows;
        this.currentPage = currentPage;
        this.size = size;
    }
} 